<template>
	<view>
		<u-tabbar :placeholder='false' :value="current" inactiveColor='#515151' activeColor='#DF302B'
			:safeAreaInsetBottom="true" fixed placeholder>
			<u-tabbar-item v-for="(item,index) in list" :key="index" :text="item.text" @click="changeFun">
				<image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.iconPath" mode="widthFix">
				</image>
				<image class="u-page__item__slot-icon" slot="active-icon" :src="item.selectedIconPath" mode="widthFix">
				</image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		name: "appTab",
		props: {
			current: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				list: [{
					iconPath: "../../static/tabBar/home.png",
					selectedIconPath: "../../static/tabBar/home-fill.png",
					text: '商城',
					Page: '/pages/home/home'
				}, {
					iconPath: "../../static/tabBar/business.png",
					selectedIconPath: "../../static/tabBar/business-fill.png",
					text: '资讯',
					Page: '/pages/Information/Information'
				}, {
					iconPath: "../../static/tabBar/wallet.png",
					selectedIconPath: "../../static/tabBar/wallet-fill.png",
					text: '钱包',
					Page: '/pages/wallet/wallet'
				}, {
					iconPath: "../../static/tabBar/customer.png",
					selectedIconPath: "../../static/tabBar/customer-fill.png",
					text: '我的',
					Page: '/pages/member/member'
				}]
			};
		},
		onshow() {},
		methods: {
			changeFun(e) {
				uni.switchTab({
					url: this.list[e].Page
				})
			}
		}
	}
</script>

<style lang="scss">
	.u-page__item__slot-icon {
		width: 40rpx;

	}
</style>